Skip to content

Redis output to store last values #35

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

streamnsight
Copy link

Thanks for contributing to Logstash! If you haven't already signed our CLA, here's a handy link: https://www.elastic.co/contributor-agreement/


This PR augments the original logstash-redis-output plugin to store the last value(s) of each key in the event object.

The original redis output stores every event in a LIST, which just grows undefinitely unless trimmed by some other consumer.

This PR adds 2 modes:

  • last_n_values will store the last n values of each key in the event object into a LIST (LPUSH and TRIM) with an EXPIRE value if defined. stack_size defines how many values are kept.
  • last_value will store the last value of each key in the event object with SET with an EXPIRE value if defined.

In both cases the keys are stores under the top level key defined by key, into a tree structure matching the object.

Each write is done in a MULTI transaction so as to be sure to store all key/values at once.

Note: Since 5.alpha is alpha and not quite out yet, the PR is for Logstash 2.3.x, so the version number and dependencies are matching this version.

Let me know if this needs more attention.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants